<template>
  <div>
    <h1>Profile</h1>
    <div v-if="session">
      <p>Welcome, {{ session.user?.email }}</p>
      <pre>{{ JSON.stringify(session, null, 2) }}</pre>
    </div>
    <div v-else>
      <p>Loading session...</p>
    </div>
  </div>
</template>

<script setup lang="ts">
import { ref, onMounted } from 'vue';
import { auth } from '../lib/auth-client';
import type { Session } from '@better-auth/client';

const session = ref<Session<typeof auth> | null>(null);

onMounted(async () => {
  session.value = await auth.getSession();
});
</script>